<?php
namespace Common\Model;

use Think\Model\RelationModel;

class PostModel extends RelationModel
{
    protected $_link = array(
        'sender_province'=>array(
            'mapping_type'  => self::BELONGS_TO,
            'class_name'    => 'Address',
            'foreign_key'   => 'sender_province',
            'mapping_fields'=> 'name'

        ),
        'sender_city'=>array(
            'mapping_type'  => self::BELONGS_TO,
            'class_name'    => 'Address',
            'foreign_key'   => 'sender_city',
            'mapping_fields'=> 'name'
        ),
        'sender_county'=>array(
            'mapping_type'  => self::BELONGS_TO,
            'class_name'    => 'Address',
            'foreign_key'   => 'sender_county',
            'mapping_fields'=> 'name'
        ),
        'sender_town'=>array(
            'mapping_type'  => self::BELONGS_TO,
            'class_name'    => 'Address',
            'foreign_key'   => 'sender_town',
            'mapping_fields'=> 'name'
        ),
        'sender_village'=>array(
            'mapping_type'  => self::BELONGS_TO,
            'class_name'    => 'Address',
            'foreign_key'   => 'sender_village',
            'mapping_fields'=> 'name'
        ),
        'accept_province'=>array(
            'mapping_type'  => self::BELONGS_TO,
            'class_name'    => 'Address',
            'foreign_key'   => 'accept_province',
            'mapping_fields'=> 'name'
        ),
        'accept_city'=>array(
            'mapping_type'  => self::BELONGS_TO,
            'class_name'    => 'Address',
            'foreign_key'   => 'accept_city',
            'mapping_fields'=> 'name'
        ),
        'accept_county'=>array(
            'mapping_type'  => self::BELONGS_TO,
            'class_name'    => 'Address',
            'foreign_key'   => 'accept_county',
            'mapping_fields'=> 'name'
        ),
        'accept_town'=>array(
            'mapping_type'  => self::BELONGS_TO,
            'class_name'    => 'Address',
            'foreign_key'   => 'accept_town',
            'mapping_fields'=> 'name'
        ),
        'accept_village'=>array(
            'mapping_type'  => self::BELONGS_TO,
            'class_name'    => 'Address',
            'foreign_key'   => 'accept_village',
            'mapping_fields'=> 'name'
        )
    );
}